/* 免费书城主题样式 - 简约阅读风格 */

/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fafafa;
    font-size: 16px;
}

/* ==================== 布局容器 ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.main-content {
    min-height: calc(100vh - 140px);
    padding: 20px 0;
}

/* ==================== 头部样式 ==================== */
.header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
    text-decoration: none;
}

.logo:hover {
    color: #3498db;
}

.nav {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav a {
    color: #666;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav a:hover {
    color: #3498db;
}

.search-box {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 16px;
    width: 300px;
}

.search-input {
    border: none;
    background: none;
    outline: none;
    flex: 1;
    font-size: 14px;
}

.search-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
}

/* ==================== 书籍卡片样式 ==================== */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.book-card {
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.book-card:hover {
    text-decoration: none;
    color: inherit;
}

.book-cover {
    width: 100%;
    height: 240px;
    object-fit: cover;
    background: #f0f0f0;
}

.book-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    overflow: hidden;
}

.book-author {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 8px;
}

.book-desc {
    font-size: 13px;
    color: #95a5a6;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 12px;
    color: #95a5a6;
}

.free-tag {
    background: #27ae60;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* ==================== 分类标题 ==================== */
.section-title {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    margin: 40px 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: #e74c3c;
}

/* ==================== 分类导航 ==================== */
.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
}

.category-link {
    padding: 8px 16px;
    background: #ecf0f1;
    color: #7f8c8d;
    text-decoration: none;
    border-radius: 20px;
    font-size: 14px;
    transition: all 0.3s;
}

.category-link:hover {
    background: #3498db;
    color: white;
    text-decoration: none;
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #95a5a6;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: #7f8c8d;
}

/* ==================== 底部样式 ==================== */
.footer {
    background: #2c3e50;
    color: #ecf0f1;
    text-align: center;
    padding: 30px 0;
    margin-top: 40px;
}

.footer p {
    margin-bottom: 10px;
}

.footer a {
    color: #3498db;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header-content {
        flex-direction: column;
        height: auto;
        padding: 15px 0;
        gap: 15px;
    }
    
    .nav {
        gap: 20px;
    }
    
    .search-box {
        width: 100%;
        max-width: 300px;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .book-cover {
        height: 180px;
    }
    
    .book-info {
        padding: 12px;
    }
    
    .book-title {
        font-size: 14px;
    }
    
    .section-title {
        font-size: 20px;
        margin: 30px 0 15px 0;
    }
    
    .main-content {
        padding: 15px 0;
    }
}

@media (max-width: 480px) {
    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .book-cover {
        height: 160px;
    }
    
    .nav {
        flex-direction: column;
        gap: 10px;
    }
    
    .category-nav {
        justify-content: center;
    }
}

/* ==================== 阅读页面样式 ==================== */
.reading-container {
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.reading-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.reading-title {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
}

.reading-meta {
    color: #7f8c8d;
    font-size: 14px;
}

.reading-content {
    padding: 30px;
    line-height: 1.8;
    font-size: 16px;
    color: #2c3e50;
}

.reading-content p {
    margin-bottom: 20px;
}

.reading-content h1,
.reading-content h2,
.reading-content h3 {
    margin: 30px 0 15px 0;
    color: #2c3e50;
}

/* ==================== 章节导航 ==================== */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.chapter-btn {
    padding: 10px 20px;
    background: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s;
}

.chapter-btn:hover {
    background: #2980b9;
    text-decoration: none;
    color: white;
}

.chapter-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

/* ==================== 工具类 ==================== */
.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

.hidden {
    display: none;
}

/* ==================== 阅读优化 ==================== */
/* 夜间模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }

    .header {
        background: #2c2c2c;
        border-bottom-color: #404040;
    }

    .book-card, .reading-container {
        background: #2c2c2c;
        color: #e0e0e0;
    }

    .book-title {
        color: #e0e0e0;
    }

    .search-box {
        background: #404040;
        border-color: #555;
    }

    .footer {
        background: #1a1a1a;
        color: #b0b0b0;
    }
}

/* 打印样式 */
@media print {
    .header, .footer, .chapter-nav, .category-nav {
        display: none;
    }

    .reading-content {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
    }

    .reading-container {
        box-shadow: none;
        border: none;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .book-card {
        border: 2px solid #000;
    }

    .chapter-btn {
        border: 2px solid #000;
    }
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}
